home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_pow_ewebammo_m.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
3KB
|
143 lines
# Jedi Knight MOTHS Cog Script
#
# POW_ENERGY.COG
#
# POWERUP Script - Energy
#
# [YB, CYW, SRS]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
template explode=+small_exp local
thing powerup local
thing player local
thing sender local
int bin=92 local
sound pickupsnd=nrgpu1.wav local
sound respawnsnd=Activate01.wav local
flex amount local
int bin_contents=0 local
int autoselect_weapon=-1 local
int damage local
message created
message damaged
message touched
message taken
message respawn
message timer
end
# ========================================================================================
code
created:
SetThingUserData(GetSenderRef(), 30); // set the initial user data (i.e. "health")
Return;
# ........................................................................................
touched:
player = GetSourceRef();
if (GetThingType(player) == 10) // Can only be taken by players.
{
amount = GetInv(player, bin);
if ((amount < GetInvMax(player, bin)) || IsMulti())
{
powerup = GetSenderRef();
TakeItem(powerup, player);
}
}
Return;
# ........................................................................................
damaged:
sender = GetSenderRef();
// only take damage 33% of the time
if(rand() < 0.33)
return;
// If it's already dead, don't allow any more damage.
if (!GetThingUserData (sender))
return;
damage = GetParam (0);
// see if this will cause the explosion
if (GetThingUserData (sender) <= damage)
{
SetThingUserData(sender, 0);
// timer for base explosion
SetTimerEx ((Rand () * 0.5), sender, 1, 0);
}
else
{
SetThingUserData(sender, GetThingUserData (sender) - damage);
}
ReturnEx (0);
return;
# ........................................................................................
taken:
powerup = GetSenderRef();
// // If the object has been destroyed, don't award it to the player.
// if (!GetThingUserData (powerup))
// return;
player = GetSourceRef();
// Print("Energy Cells");
jkPrintUNIString(player, bin);
// Do effects.
PlaySoundLocal(pickupsnd, 1, 0, 0);
AddDynamicTint(player, 0.0, 0.0, 0.2);
// store the old bin contents
bin_contents = GetInv(player, bin);
// Increment powerup amount.
ChangeInv(player, bin, 100.0);
return;
# ........................................................................................
respawn:
SetThingUserData(GetSenderRef(), 30); // set the initial user data (i.e. "health")
PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
return;
# ........................................................................................
timer:
sender = GetSenderId ();
powerup = CreateThingNR (explode, sender);
TakeItem(sender, -1);
return;
end